﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QLTV_V2.DataAccess;

namespace QLTV_V2
{
    public partial class FrmXemCT_MT : Form
    {
        public FrmXemCT_MT()
        {
            InitializeComponent();
        }
        Utilities uti = new Utilities();
        public string maMT, mabd;
        public int dk;
        private void FrmXemCT_MT_Load(object sender, EventArgs e)
        {
            if (dk == 1)
            {
                dgv_PhieuMT.DataSource = uti.getDataSource_DK("PhieuMuonTra", "MaMuonTra", maMT, "MaMuonTra");
            }
            else
            {
                dgv_PhieuMT.DataSource = uti.getDataSource_DK("PhieuMuonTra", "MaBanDoc", mabd, "MaMuonTra");
            }
        }

        private void dgv_PhieuMT_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                int dong = dgv_PhieuMT.CurrentCell.RowIndex;
                string maCT = dgv_PhieuMT.Rows[dong].Cells["MaMuonTra"].Value.ToString();
                dgv_CTMuonTra.DataSource = uti.getDataSource_DK("CTMuonTra", "MaMuonTra", maCT, "MaCTMuonTra");
            }
            catch { }
        }

        private void dgv_PhieuMT_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            uti.dgv_GetSTT_RowHeader(sender, e, dgv_PhieuMT);
        }

        private void dgv_CTMuonTra_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            uti.dgv_GetSTT_RowHeader(sender, e, dgv_CTMuonTra);

        }
    }
}
